import {
    onMounted,
    onUnmounted,
    reactive
} from "vue";

export default function(){
    let pointer = reactive({
        x:0,
        y:0
    });

    function clickEvent(e){
        pointer.x = e.pageX;
        pointer.y = e.pageY;
    }

    onMounted(()=>{
        window.onclick = clickEvent
    })

    onUnmounted(()=>{
        window.removeEventListener('click',clickEvent)
    })

    return pointer;
}